﻿using DeltaGroup.WheelOfJeopardy.Util;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace DeltaGroup.WoJ.Tests.WheelTests
{
    /// <summary>
    ///This is a test class for WheelMathUtilTest and is intended
    ///to contain all WheelMathUtilTest Unit Tests
    ///</summary>
    [TestClass]
    public class WheelMathUtilTest
    {
        #region Fields

        private TestContext testContextInstance;

        #endregion Fields

        #region Properties

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #endregion Properties

        #region Methods

        /// <summary>
        ///A test for CalculateSelectedSectorIndex
        ///</summary>
        [TestMethod]
        public void CalculateSelectedSectorIndexTest24d0()
        {
            int sectorCount = 24;
            double degreesFromZero = 0d;
            int expected = 23;
            int actual;
            actual = WheelMathUtil.CalculateSelectedSectorIndex(sectorCount, degreesFromZero);
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for CalculateSelectedSectorIndex
        ///</summary>
        [TestMethod]
        public void CalculateSelectedSectorIndexTest24d0p6()
        {
            int sectorCount = 24;
            double degreesFromZero = 0.6d;
            int expected = 23;
            int actual;
            actual = WheelMathUtil.CalculateSelectedSectorIndex(sectorCount, degreesFromZero);
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for CalculateSelectedSectorIndex
        ///</summary>
        [TestMethod]
        public void CalculateSelectedSectorIndexTest24d359()
        {
            int sectorCount = 24;
            double degreesFromZero = 359d;
            int expected = 0;
            int actual;
            actual = WheelMathUtil.CalculateSelectedSectorIndex(sectorCount, degreesFromZero);
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for CalculateSelectedSectorIndex
        ///</summary>
        [TestMethod]
        public void CalculateSelectedSectorIndexTest24d359p6()
        {
            int sectorCount = 24;
            double degreesFromZero = 359.6d;
            int expected = 0;
            int actual;
            actual = WheelMathUtil.CalculateSelectedSectorIndex(sectorCount, degreesFromZero);
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for CalculateSelectedSectorIndex
        ///</summary>
        [TestMethod]
        public void CalculateSelectedSectorIndexTest24d360()
        {
            int sectorCount = 24;
            double degreesFromZero = 360d;
            int expected = 23;
            int actual;
            actual = WheelMathUtil.CalculateSelectedSectorIndex(sectorCount, degreesFromZero);
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for CalculateSelectedSectorIndex
        ///</summary>
        [TestMethod]
        public void CalculateSelectedSectorIndexTest9d0()
        {
            int sectorCount = 9;
            double degreesFromZero = 0d;
            int expected = 8;
            int actual;
            actual = WheelMathUtil.CalculateSelectedSectorIndex(sectorCount, degreesFromZero);
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for CalculateSelectedSectorIndex
        ///</summary>
        [TestMethod]
        public void CalculateSelectedSectorIndexTest9d359p6()
        {
            int sectorCount = 9;
            double degreesFromZero = 359.6d;
            int expected = 0;
            int actual;
            actual = WheelMathUtil.CalculateSelectedSectorIndex(sectorCount, degreesFromZero);
            Assert.AreEqual(expected, actual);
        }

        [TestMethod]
        public void CalculateWheelSectorDegreesTest21()
        {
            int sectorCount = 21;
            double expected = (360d/21d);
            double actual;
            actual = WheelMathUtil.CalculateWheelSectorDegrees(sectorCount);
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for CalculateWheelSectorDegrees
        ///</summary>
        [TestMethod]
        public void CalculateWheelSectorDegreesTest24()
        {
            int sectorCount = 24;
            double expected = 15;
            double actual;
            actual = WheelMathUtil.CalculateWheelSectorDegrees(sectorCount);
            Assert.AreEqual(expected, actual);
        }

        #endregion Methods

    }
}